package com.kitty.game.fight.bean;

import com.kitty.game.pet.model.Pet;
import com.kitty.game.fight.message.vo.FightMember;
import com.kitty.game.mirror.model.PetMirror;
import com.kitty.game.fight.bean.FightObject;
import lombok.Getter;

public class PetMirrorFightObject extends FightObject {

    @Getter
    private Pet pet;

    public PetMirrorFightObject(PetMirror petMirror, int id, FightObject master, int pos, boolean isASide) {
        Pet pet = new Pet();
        pet.setId(id);
        pet.setName(petMirror.getName());
        pet.setType(petMirror.getType());
        pet.setIntimacy(petMirror.getIntimacy());
        pet.setMartial(petMirror.getMartial());
        this.pet = pet;

        setPos(pos);
        setName(petMirror.getName());
        setLevel(petMirror.getLevel());
        setId(id);
        setDefense(petMirror.getDefense());
        setSpeed(petMirror.getSpeed());
        setMagPower(petMirror.getMagPower());
        setPhyPower(petMirror.getPhyPower());
        setMaxLife(petMirror.getMaxLife());
        setMaxMana(petMirror.getMaxMana());
        setCurrLife(petMirror.getMaxLife());
        setIcon(petMirror.getIcon());
        setPolar(petMirror.getPolar());
        setSkillIds(petMirror.getSkillIds());
        setHostId(master.getId());
        setASide(isASide);
    }

    @Override
    public int getTao(){
        return pet.getMartial()/  10000 * 360 ;
    }
    @Override
    public int getMagHurt(FightObject target, boolean isPenetrate) {
        return super.getMagHurt(target, isPenetrate);
    }

    @Override
    public int getPhyHurt(FightObject target, boolean isPenetrate) {
        return super.getPhyHurt(target, isPenetrate);
    }


    @Override
    public FightMember asFightMember() {
        FightMember fightMember = new FightMember();
        fightMember.setId(getId());
        fightMember.setWeapon_icon((short) 0);
        fightMember.setColor((short) 2);
        fightMember.setPosition((short) getPos());
        fightMember.setIcon((short) getIcon());
        fightMember.setList(asFieldValues());

        return fightMember;
    }

    @Override
    public String toString() {
        return "PetMirrorFightObject{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
}
